
/*
 * this class is where the strategy pattern is called from.  
 */
public class Context 
{
	Strategy strat;

	public Context()
	{
	}
	
	public Context(Strategy strat)
	{
		this.strat = strat;
	}

	public Faculty execute(StringBuffer buff)
	{
		return this.strat.execute(buff);
	}

	public Strategy getStrategy(StringBuffer buff, String name)
	{
		
		/*
		 *	In the final version of the project, this method will use heuristics
		 *	to properly determine which strategy to use. Here it uses the selected value from the view
		 */
		
		Strategy strat;
		
		if (name.equalsIgnoreCase("UCD"))
		{
			strat = new UCDStrategy();
		}
		else if (name.equalsIgnoreCase("Trinity College"))
		{
			strat = new TCDStrategy();
		}
		else
		{
			strat = new ULStrategy();
		}
		return strat;
	}

	public void setStrategy(StringBuffer buff, String name)
	{
		this.strat = getStrategy(buff, name);
	}
}
